﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BarberShop.BLL;

public partial class MoviePlayList :BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GetMoviePlayData();
        }
    }

    protected void btn_search_Click(object sender, EventArgs e)
    {
        GetMoviePlayData();
    }

    //getData
    protected void GetMoviePlayData()
    {
        string name = tx_movieName.Text.Trim();
        var data = MoviePalyListBLL.GetMoviePalyList(name);
        this.Grid_Movie.DataSource = data;
        this.Grid_Movie.DataBind();
    }


    protected void Grid_Movie_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        this.Grid_Movie.PageIndex = e.NewSelectedIndex;
    }

    protected string GetTotalSize(int sortid)
    {
        double size=MoviePalyListBLL.GetTotalSize(sortid);
        string sizename = "";
        if (size / 1024 < 1024)
        {
            sizename = (size / (double)1024).ToString("N2") + "Kb";
        }
        else if (size / 1024 / 1024 < 1024)
        {
            sizename = (size / (double)1024 / (double)1024).ToString("N2") + "Mb";
        }
        else
        {
            sizename = (size / (double)1024 / (double)1024 / (double)1024).ToString("N2") + "Gb";
        }
        return sizename;
    }
}